package com.example.liuhb.androidannotations;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.widget.TextView;

import com.example.liuhb.androidannotations.entity.MsgInfo;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.Extra;
import org.androidannotations.annotations.ViewById;

/**
 * Created by liu.hb on 2018/2/13.
 */
//1.设置布局
@EActivity(R.layout.activity_aa)
public class aaActivity extends AppCompatActivity {
    //5.定义常量

    MsgInfo msgInfo;

    @Extra
   public String mInfoStr;   // 可被外部访问到

    @ViewById(R.id.mTvShowInfo)
    TextView mTvShowInfo;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
    @AfterViews
    void initViews() {
        if (!TextUtils.isEmpty(mInfoStr)) {
            mTvShowInfo.setText(mInfoStr);
        } else {
            mTvShowInfo.setText("mInfoStr is empty!");
        }
    }
    //4.设置控件点击事件
    @Click(R.id.btn)
    void btnClick() {
        //6.打开新的Activity
        MainActivity_.intent(this).start(); // 不带参数
        finish();
    }
}
